package com.ruoyi.mall.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mall.mapper.MallTimeConfigMapper;
import com.ruoyi.mall.domain.MallTimeConfig;
import com.ruoyi.mall.service.IMallTimeConfigService;

/**
 * 抢购区基础设置Service业务层处理
 *
 * @author ruoyi
 * @date 2022-02-25
 */
@Service
public class MallTimeConfigServiceImpl implements IMallTimeConfigService
{
    @Autowired
    private MallTimeConfigMapper mallTimeConfigMapper;

    /**
     * 查询抢购区基础设置
     *
     * @param id 抢购区基础设置主键
     * @return 抢购区基础设置
     */
    @Override
    public MallTimeConfig selectMallTimeConfigById(Long id)
    {
        return mallTimeConfigMapper.selectMallTimeConfigById(id);
    }

    /**
     * 查询抢购区基础设置列表
     *
     * @param mallTimeConfig 抢购区基础设置
     * @return 抢购区基础设置
     */
    @Override
    public List<MallTimeConfig> selectMallTimeConfigList(MallTimeConfig mallTimeConfig)
    {
        return mallTimeConfigMapper.selectMallTimeConfigList(mallTimeConfig);
    }

    /**
     * 新增抢购区基础设置
     *
     * @param mallTimeConfig 抢购区基础设置
     * @return 结果
     */
    @Override
    public int insertMallTimeConfig(MallTimeConfig mallTimeConfig)
    {
        mallTimeConfig.setCreateTime(DateUtils.getNowDate());
        return mallTimeConfigMapper.insertMallTimeConfig(mallTimeConfig);
    }

    /**
     * 修改抢购区基础设置
     *
     * @param mallTimeConfig 抢购区基础设置
     * @return 结果
     */
    @Override
    public int updateMallTimeConfig(MallTimeConfig mallTimeConfig)
    {
        mallTimeConfig.setUpdateTime(DateUtils.getNowDate());
        return mallTimeConfigMapper.updateMallTimeConfig(mallTimeConfig);
    }

    /**
     * 批量删除抢购区基础设置
     *
     * @param ids 需要删除的抢购区基础设置主键
     * @return 结果
     */
    @Override
    public int deleteMallTimeConfigByIds(Long[] ids)
    {
        return mallTimeConfigMapper.deleteMallTimeConfigByIds(ids);
    }

    /**
     * 删除抢购区基础设置信息
     *
     * @param id 抢购区基础设置主键
     * @return 结果
     */
    @Override
    public int deleteMallTimeConfigById(Long id)
    {
        return mallTimeConfigMapper.deleteMallTimeConfigById(id);
    }

    @Override
    public MallTimeConfig findMallTimeConfig() {
        return mallTimeConfigMapper.findMallTimeConfig();
    }
}
